/**
 * Login.js
 *
 * @description :: A model definition represents a database table/collection.
 * @docs        :: https://sailsjs.com/docs/concepts/models-and-orm/models
 */
const dateCheck = require('../common/datetime_check')

module.exports = {
  datastore: 'mysql',
  tableName: 'login',
  primaryKey: 'id',

  attributes: {
    id: {
      columnName: 'login_id',
      type: 'number',
      autoIncrement: true
    },
    loginName: {
      columnName: 'login_name',
      type: 'string',
      required: true,
      allowNull: false,
      unique: true
    },
    password: {
      columnName: 'password',
      type: 'string',
      required: true,
      allowNull: false
    },
    userId: {
      columnName: 'user_id',
      type: 'number',
      required: true,
      allowNull: false
    },
    // createdAt: {
    //   columnName:'create_time',
    //   type:'string',
    //   required:true,
    //   allowNull:false,
    //   custom:function(value){
    //     return dateCheck.isDateTime(value)
    //   }
    // },
    updatedAt: {
      columnName:'update_time',
      type:'string',
      required:false,
      allowNull:true,
      custom:function(value){
        return dateCheck.isDateTime(value)
      }
    }
  },

};

